package com.xiaobai.demo;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.FutureTask;
@Slf4j
public class TestFutureTask {
    public static void main(String[] args) {
        FutureTask<Integer> task = new FutureTask<>(() -> {
            log.debug("running.....");
            Thread.sleep(100);
            return 100;
        });
        new Thread(task,"FutureTaskThread").start();
        try {
           log.info("{}",task.get());
        } catch (Exception e) {
            log.error(e.getMessage());
        }
    }
}
